package org.lex.dbq.view.sql;

import org.lex.dbq.model.jdbc.object.ObjectNode;
import org.lex.dbq.model.jdbc.object.ObjectType;
import org.lex.dbq.model.jdbc.object.TreeUtils;
import org.lex.dbq.view.ddl.EditTableDialog;

public class EditTableAction extends BaseSqlAction {

	public EditTableAction(SqlPane pane) {
		super(pane);
		this.setText("Edit");
	}

	public void run() {
		ObjectNode table = this.getSelectedNode();
		if (null == table || ObjectType.TABLE != table.getType()) {
			return;
		}

		String catalog = TreeUtils.getCatalogName(table);

		EditTableDialog.show(getShell(), pane.conn, catalog, null, table.getData());
	}
}
